<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/modules/cms/front/include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
	<title>用户注册</title>
	<meta name="decorator" content="cms_default_${site.theme}"/>
	<meta name="description" content="ccjzxyxt ${site.description}" />
	<meta name="keywords" content="ccjzxyxt ${site.keywords}" />
	<link href="${ctxStatic}/jquery-validation/1.11.1/jquery.validate.min.css" type="text/css" rel="stylesheet" />
	<script src="${ctxStatic}/jquery-validation/1.11.1/jquery.validate.min.js" type="text/javascript"></script>
	<script src="${ctxStatic}/jquery-validation/1.11.1/jquery.validate.method.min.js" type="text/javascript"></script>
	<script type="text/javascript">
		$(document).ready(function() {
			<c:if test="${not empty message}">alert("${message}");</c:if>
			$("#inputForm").validate({
				rules: {
					validateCode: {remote: "${pageContext.request.contextPath}/servlet/validateCodeServlet"}
				},
				messages: {
					content: {required: "请填写留言内容"}
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
			$("#main_nav li").each(function(){
				$(this).toggleClass("active", $(this).text().indexOf('注册')>=0);
			});
		});
        function getRootPath(){
            var curWwwPath=window.document.location.href;
            var pathName=window.document.location.pathname;
            var pos=curWwwPath.indexOf(pathName);
            var localhostPaht=curWwwPath.substring(0,pos);
            //var projectName=pathName.substring(0,pathName.substr(1).indexOf('/')+1);
            return(localhostPaht);
        }
		function sub() {
                $.ajax({
                    type: "post",
                    url: getRootPath+"",
                    dataType: "json",
                    success: function (data) {
                        alert("注册成功");
                    },
                    error: function (data) {
                        alert(data.message);
                    }
                });
        }
	</script>
</head>
<body>
	<div style="padding:0 0 20px;">
		<h4>用户注册</h4>
		<form:form id="inputForm" method="post" class="form-horizontal">
			<div class="control-group">
				<label class="control-label">姓名:</label>
				<div class="controls">
					<input type="text" name="name" maxlength="11" class="required" style="width:300px;"/>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">身份证号(登录名):</label>
				<div class="controls">
					<input type="text" name="LoginName" maxlength="50" class="required" style="width:300px;"/>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">密码:</label>
				<div class="controls">
					<input type="password" name="password" maxlength="50"  minlength="3"  class="required" style="width:300px;"/>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">确认密码:</label>
				<div class="controls">
					<input type="password" name="confirmNewPassword"  maxlength="50" minlength="3" class="required"  style="width:300px;"/>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">邮箱:</label>
				<div class="controls">
					<input type="text" name="email" maxlength="50" class="required email" style="width:300px;"/>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">手机:</label>
				<div class="controls">
					<input type="text" name="mobile" maxlength="50" class="required phone" style="width:300px;"/>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">用户类型:</label>
				<div class="controls">
					<select name="userType" class="txt required" style="width:100px;">
						<option value="">请选择</option>
							<option value="2">教师</option>
							<option value="3">学生</option>
							<option value="4">校外人员</option>
					</select>
				</div>
			</div>
			<%--<div class="control-group">
				<label class="control-label">验证码:</label>
				<div class="controls">
					<sys:validateCode name="validateCode" />
				</div>
			</div>--%>
			<div class="form-actions">
				<input class="btn" value="提 交" onclick="sub()"/>&nbsp;
			</div>
			<div id="messageBox" class="alert alert-error" style="display:none">输入有误，请先更正。</div>
		</form:form>
	</div>
</body>
</html>